home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / librw / RWGSlist.z / RWGSlist
Encoding:
Text File  |  2002-10-03  |  11.1 KB  |  331 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWGGGGSSSSlllliiiisssstttt((((3333CCCC++++++++))))                                                  RRRRWWWWGGGGSSSSlllliiiisssstttt((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWGSlist(type) - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include <rw/gslist.h>
  13.  
  14.  
  15.  
  16.               declare(RWGSlist, type)
  17.           RWGSlist(type) a ;
  18.  
  19.  
  20.  
  21.  
  22. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  23.      Class RRRRWWWWGGGGSSSSlllliiiisssstttt((((ttttyyyyppppeeee)))) represents a group of ordered elements of type ttttyyyyppppeeee,
  24.      not accessible by an external key.  Duplicates are allowed.  This class
  25.      is implemented as a singly-linked list.  Objects of type RRRRWWWWGGGGSSSSlllliiiisssstttt((((ttttyyyyppppeeee))))
  26.      are declared with macros defined in the standard C++ header file
  27.      <<<<ggggeeeennnneeeerrrriiiicccc....hhhh>>>>.  In order to find a particular item within the collection, a
  28.      user-provided global "tester" function is required to test for a "match,"
  29.      definable in any consistent way.  This function should have prototype:
  30.  
  31.               RWBoolean yyyyoooouuuurrrrTTTTeeeesssstttteeeerrrrFFFFuuuunnnnccccttttiiiioooonnnn(const ttttyyyyppppeeee* c, const void* d);
  32.  
  33.  
  34.  
  35.  
  36.  
  37.      The argument cccc is a candidate within the collection to be tested for a
  38.      match.  The argument dddd is for your convenience and will be passed to
  39.      yyyyoooouuuurrrrTTTTeeeesssstttteeeerrrrFFFFuuuunnnnccccttttiiiioooonnnn(((()))).  The function should return TTTTRRRRUUUUEEEE if a "match" is
  40.      found between cccc and dddd.  In order to simplify the documentation below, an
  41.      imaginary typedef
  42.  
  43.               typedef RWBoolean (*yyyyoooouuuurrrrTTTTeeeesssstttteeeerrrr)(const ttttyyyyppppeeee*, const void*);
  44.  
  45.  
  46.  
  47.  
  48.  
  49.      has been used for this tester function.
  50.  
  51. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  52.      None
  53.  
  54. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  55.               RRRRWWWWGGGGSSSSlllliiiisssstttt(ttttyyyyppppeeee)();
  56.  
  57.  
  58.      Construct an empty collection.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWGGGGSSSSlllliiiisssstttt((((3333CCCC++++++++))))                                                  RRRRWWWWGGGGSSSSlllliiiisssstttt((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.               RRRRWWWWGGGGSSSSlllliiiisssstttt(ttttyyyyppppeeee)(ttttyyyyppppeeee* a);
  75.  
  76.  
  77.      Construct a collection with one entry aaaa.
  78.  
  79.               RRRRWWWWGGGGSSSSlllliiiisssstttt(ttttyyyyppppeeee)(const RWGSlist(ttttyyyyppppeeee)& a);
  80.  
  81.  
  82.      Copy constructor.  A shallow copy of aaaa is made.
  83.  
  84. AAAAssssssssiiiiggggnnnnmmmmeeeennnntttt OOOOppppeeeerrrraaaattttoooorrrr
  85.               void
  86.           ooooppppeeeerrrraaaattttoooorrrr====(const RWGSlist(type)&);
  87.  
  88.  
  89.      Assignment operator.  A shallow copy of aaaa is made.
  90.  
  91. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  92.               ttttyyyyppppeeee*
  93.           append(ttttyyyyppppeeee* a);
  94.  
  95.  
  96.      Adds an item to the end of the collection and returns it.  Returns nnnniiiillll if
  97.      the insertion was unsuccessful.
  98.  
  99.               void
  100.           aaaappppppppllllyyyy(void (*ap)(ttttyyyyppppeeee*, void*), void* );
  101.  
  102.  
  103.      Visits all the items in the collection in order, from first to last,
  104.      calling the user-provided function pointed to by aaaapppp for each item.  This
  105.      function should have prototype:
  106.  
  107.               void yyyyoooouuuurrrrAAAAppppppppllllyyyyFFFFuuuunnnnccccttttiiiioooonnnn(type* c, void*);
  108.  
  109.  
  110.  
  111.  
  112.  
  113.      and can perform any operation on the object at address cccc.  The last
  114.      argument is useful for passing data to the apply function.
  115.  
  116.               ttttyyyyppppeeee*&
  117.           aaaatttt(size_t i);
  118.           const ttttyyyyppppeeee*
  119.           aaaatttt(size_t i) const;
  120.  
  121.  
  122.      Returns a pointer to the iiiith item in the collection.  The first variant
  123.      can be used as an lvalue, the second cannot.  The index iiii must be between
  124.      zero and the number of items in the collection less one, or an exception
  125.      of type TTTTOOOOOOOOLLLL____IIIINNNNDDDDEEEEXXXX will be thrown.
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWGGGGSSSSlllliiiisssstttt((((3333CCCC++++++++))))                                                  RRRRWWWWGGGGSSSSlllliiiisssstttt((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.               void
  141.           cccclllleeeeaaaarrrr();
  142.  
  143.  
  144.      Removes all items in the collection.
  145.  
  146.               RWBoolean
  147.           ccccoooonnnnttttaaaaiiiinnnnssss(yyyyoooouuuurrrrTTTTeeeesssstttteeeerrrr t, const void* d) const;
  148.  
  149.  
  150.      Returns TTTTRRRRUUUUEEEE if the collection contains an item for which the user-
  151.      defined function pointed to by tttt finds a match with dddd.
  152.  
  153.               RWBoolean
  154.           ccccoooonnnnttttaaaaiiiinnnnssssRRRReeeeffffeeeerrrreeeennnncccceeee(const ttttyyyyppppeeee* e) const;
  155.  
  156.  
  157.      Returns TTTTRRRRUUUUEEEE if the collection contains an item with the address eeee....
  158.  
  159.               size_t
  160.           eeeennnnttttrrrriiiieeeessss() const;
  161.  
  162.  
  163.      Returns the number of items in the collection.
  164.  
  165.               ttttyyyyppppeeee*
  166.           ffffiiiinnnndddd(yyyyoooouuuurrrrTTTTeeeesssstttteeeerrrr t, const void* d) const;
  167.  
  168.  
  169.      Returns the first item in the collection for which the user-provided
  170.      function pointed to by tttt finds a match with dddd, or nnnniiiillll if no item is
  171.      found.
  172.  
  173.               ttttyyyyppppeeee*
  174.           ffffiiiinnnnddddRRRReeeeffffeeeerrrreeeennnncccceeee(const ttttyyyyppppeeee* e) const;
  175.  
  176.  
  177.      Returns the first item in the collection with the address eeee, or nnnniiiillll if no
  178.      item is found.
  179.  
  180.               ttttyyyyppppeeee*
  181.           ffffiiiirrrrsssstttt() const;
  182.  
  183.  
  184.      Returns the first item of the collection.
  185.  
  186.               ttttyyyyppppeeee*
  187.           ggggeeeetttt();
  188.  
  189.  
  190.      Returns and rrrreeeemmmmoooovvvveeeessss the first item of the collection.
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. RRRRWWWWGGGGSSSSlllliiiisssstttt((((3333CCCC++++++++))))                                                  RRRRWWWWGGGGSSSSlllliiiisssstttt((((3333CCCC++++++++))))
  203.  
  204.  
  205.  
  206.               ttttyyyyppppeeee*
  207.           iiiinnnnsssseeeerrrrtttt(ttttyyyyppppeeee* e);
  208.  
  209.  
  210.      Adds an item to the end of the collection and returns it.  Returns nnnniiiillll if
  211.      the insertion was unsuccessful.
  212.  
  213.               void
  214.           iiiinnnnsssseeeerrrrttttAAAAtttt(size_t indx, ttttyyyyppppeeee* e);
  215.  
  216.  
  217.      Adds a new item to the collection at position iiiinnnnddddxxxx.  The item previously
  218.      at position iiii is moved to iiii++++1111, eeeettttcccc.  The index iiiinnnnddddxxxx must be between 0 and
  219.      the number of items in the collection, or an exception of type TTTTOOOOOOOOLLLL____IIIINNNNDDDDEEEEXXXX
  220.      will be thrown.
  221.  
  222.               RWBoolean
  223.           iiiissssEEEEmmmmppppttttyyyy() const;
  224.  
  225.  
  226.      Returns TTTTRRRRUUUUEEEE if the collection is empty, otherwise FFFFAAAALLLLSSSSEEEE.
  227.  
  228.               ttttyyyyppppeeee*
  229.           llllaaaasssstttt() const;
  230.  
  231.  
  232.      Returns the last item of the collection.
  233.  
  234.               size_t
  235.           ooooccccccccuuuurrrrrrrreeeennnncccceeeessssOOOOffff(yyyyoooouuuurrrrTTTTeeeesssstttteeeerrrr t, const void* d) const;
  236.  
  237.  
  238.      Returns the number of occurrences in the collection for which the user-
  239.      provided function pointed to by tttt finds a match with dddd.
  240.  
  241.               size_t
  242.           ooooccccccccuuuurrrrrrrreeeennnncccceeeessssOOOOffffRRRReeeeffffeeeerrrreeeennnncccceeee(const ttttyyyyppppeeee* e) const;
  243.  
  244.  
  245.      Returns the number of items in the collection with the address eeee....
  246.  
  247.               ttttyyyyppppeeee*
  248.           pppprrrreeeeppppeeeennnndddd(const ttttyyyyppppeeee* a);
  249.  
  250.  
  251.      Adds an item to the beginning of the collection and returns it.  Returns
  252.      nnnniiiillll if the insertion was unsuccessful.
  253.  
  254.               ttttyyyyppppeeee*
  255.           rrrreeeemmmmoooovvvveeee(yyyyoooouuuurrrrTTTTeeeesssstttteeeerrrr t, const void* d);
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. RRRRWWWWGGGGSSSSlllliiiisssstttt((((3333CCCC++++++++))))                                                  RRRRWWWWGGGGSSSSlllliiiisssstttt((((3333CCCC++++++++))))
  269.  
  270.  
  271.  
  272.      Removes and returns the first item from the collection for which the
  273.      user-provided function pointed to by tttt finds a match with dddd, or returns
  274.      nnnniiiillll if no item is found.
  275.  
  276.               ttttyyyyppppeeee*
  277.           rrrreeeemmmmoooovvvveeeeRRRReeeeffffeeeerrrreeeennnncccceeee(const ttttyyyyppppeeee* e);
  278.  
  279.  
  280.      Removes and returns the first item from the collection with the address
  281.      eeee, or returns nnnniiiillll if no item is found.
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.